﻿@using ZBJF.Warranty.WebProvider
@{
    ViewBag.Title = "待审核投保";
}
@section Header{
    @Scripts.Render("~/bundles/datatable")
    @Styles.Render("~/Content/datatable")
}
@using ZBJF.Warranty.Common.Enums.InsuranceOrder
@model ZBJF.Warranty.Model.ViewModel.Order.InsuranceOrderModel

<link href="../../Content/css/Switch.css" rel="stylesheet" />
<ul class="nav nav-tabs">
    <li class="active"><a href="/InsuranceOrder/ToBeAuditedOrderList">待审核投保</a></li>
    <li><a href="/InsuranceOrder/AuditFaildOrderList">审核未通过投保</a></li>
</ul>
<form id="searchForm" class="breadcrumb form-search">    
    <div style="position:absolute; right:10px;">
        <span style="display:inline-block; height:30px; line-height:32px; float:left;">审核在线：</span>
        <div class="switch has-switch">
            <div class="@(ViewBag.IsCheckOnline ==1?"switch-on":"switch-off") switch-animate" style="">
                <span class="switch-left switch-success">ON</span>
                <span style="margin-left:0px;width:33.3%; line-height:0px">&nbsp;</span>
                <span class="switch-right switch-warning">OFF</span>
            </div>
        </div>
    </div> 
    @RenderPage("/Views/InsuranceOrder/SearchPanel.cshtml")
</form>
<div class="table-responsive dataTables_wrapper">
    <table id="insuranceOrderList" class="table table-striped table-bordered table-hover">
        <thead>
            <tr>
                <th width="10">序号</th>
                <th>工单号</th>
                <th>保险产品</th>
                <th>被保险人</th>
                <th>被保险人电话</th>
                <th>设备识别码 </th>
                <th width="60">第三方承保公司 </th>
                <th width="60">承保公司分公司 </th>
                <th>工单来源</th>
                <th>购买方式</th>
                <th>保险价格</th>
                <th>保单状态</th>
                <th>投保时间</th>
                <th>操作</th>
            </tr>
        </thead>
    </table>
</div>
@RenderPage("/Views/PubModelDialog/InsuranceOrderCheckLogList.cshtml")<!--要放到DIV外面-->
@section scripts{
    @Scripts.Render("~/Bundles/ImagePreview")
    <script type="text/javascript">
        var isSearch = false;
        $(function () {
            var objTable = $("#insuranceOrderList")
                .dataTable({
                    fnDrawCallback: function () {
                        ControlPermissionOperate();
                    },
                    "sAjaxSource": "/InsuranceOrder/Index?OrderStatus=@((int)InsuranceOrderStatus.Create)",
                    "aaSorting": [[12, "desc"]],
                    aoColumns: [
                        {
                            "mData": null, "fnRender": function (nRow) {
                                return nRow.iDataRow + 1;
                            }
                        },
                        {
                            "mData": "OrderNO", "fnRender": function (nRow) {
                                return "<a class='Detail-R' target='_blank'  href='/InsuranceOrder/Detail/" + nRow.aData.ID + "'  onmouseover='javascript:showInsuranceOrderCheckLog(\"" + nRow.aData.ID + "\",this);' onmouseout='hideInsuranceOrderCheckLog()'>" + nRow.aData.OrderNO + "</a>";
                            }
                        },
                        { "mData": "ProductName" },
                        { "mData": "UserName" },
                        { "mData": "UserPhone" },
                        { "mData": "IMEI" },
                        { "mData": "InsuranceCompany" },
                        { "mData": "InsuranceCompanyBranch" },
                        { "mData": "OrderFromTypeDesc", mDataProp: "OrderFromType" },
                        { "mData": "BuyTypeDesc", mDataProp: "BuyType" },
                        { "mData": "Price" },
                        { "mData": "OrderStatusDesc", mDataProp: "OrderStatus" },
                        { "mData": "CreateOrderTime" },
                        {
                            "mData": null, fnRender: function (nRow) {
                                return "<a class='Detail-R' target='_blank' href='/InsuranceOrder/Detail/" + nRow.aData.ID + "' title='点击查看'><i class='icon-edit'></i></a>";
                            }
                        }
                    ]
                });


            $(".switch-left").on("click", function () {
                $.ajax({
                    type: "POST",
                    url: "../InsuranceOrder/CloseCheckTask",
                    dataType: "json",
                    success: function (data) {
                        if (data.Result) {
                            $(".switch-animate").removeClass("switch-on").addClass("switch-off");
                        } else {
                            layer.alert("操作失败");
                        }
                    }
                });

            })
            $(".switch-right").on("click", function () {
                $.ajax({
                    type: "POST",
                    url: "../InsuranceOrder/OpenCheckTask",
                    dataType: "json",
                    success: function (data) {
                        if (data.Result) {
                            $(".switch-animate").removeClass("switch-off").addClass("switch-on");
                        } else {
                            layer.alert("操作失败");
                        }
                    }
                });
            })

        });
    </script>
}


